/*
 * @lc app=leetcode.cn id=69 lang=java
 *
 * [69] x 的平方根 
 */

// @lc code=start
class Solution {
    public int mySqrt(int x) {
        int i=0;
        for (; i <= Math.max(3,x/2); i++) {
            long middle=(long)i*i;
            if (middle>x) {
                return i-1;
            }
            if(middle==x)
                return i;
        }
        return i;
    }
}
// @lc code=end

